package com.pure.common.singleton;

/**
 * @description: singleton inner test
 * @date: 2022-11-09 17:05
 * @since 1.2.0
 **/
public class SingletonInnerTest {
    public static void main(String[] args) {

        System.out.println(SingletonInner.getInstance().hashCode());

        Class<SingletonInner> singletonInnerClass = SingletonInner.class;
        try {
            // 私有化的构造方法，反射创建对象实例失败
            // can not access a member of class with modifiers "private" （不能访问带有 “private” 修饰符的类的成员）
            SingletonInner newInstance = singletonInnerClass.newInstance();
            System.out.println(newInstance.hashCode());
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }


    }
}
